package dao.univ;

import java.util.List;

import util.paramvo.SearchParamVO;
import vo.UnivVO;

import com.ibatis.sqlmap.client.SqlMapClient;

public class UnivDAOImpl implements UnivDAO{

	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	@Override
	public UnivVO getUnivInfo(int univ_no) throws Exception {
		return (UnivVO) sqlMapClient.queryForObject("univ.getUnivInfo", univ_no);
	}

	@Override
	public List<UnivVO> getSearchedUnivByWord(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("univ.getSearchedUnivByWord", search);
	}

	@Override
	public int countSearchedUnivByWord(List<String> search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("univ.countSearchedUnivByWord", search);
	}

	@Override
	public void registerUniv(UnivVO param) throws Exception {
		sqlMapClient.insert("univ.registerUniv", param);
	}

	@Override
	public void updateUniv(UnivVO param) throws Exception {
		sqlMapClient.update("univ.updateUniv", param);
	}

	@Override
	public void deleteUniv(int univ_no) throws Exception {
		sqlMapClient.update("univ.deleteUniv", univ_no);
	}
}
